package com.example.administrator.printoutindemo;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class CheckUser implements Serializable{

	private int _check_id;
	private String _user_name;

	// 将JSON对象转化为list
	public List<CheckUser> getListFromJSON(String JsonStr) {
		List<CheckUser> clist = new ArrayList<CheckUser>();

		try {

			JSONArray jay = new JSONArray(JsonStr);// 将字符串转化为JSON数组

			for (int i = 0; i < jay.length(); i++) {
				JSONObject temp = (JSONObject) jay.get(i);

				CheckUser n = new CheckUser();

				n.set_check_id(Integer.parseInt(temp.getString("check_id")));
				n.set_user_name(temp.getString("user_name"));

				clist.add(n);

			}

		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}

		return clist;

	}

	public int get_check_id() {
		return _check_id;
	}
	public void set_check_id(int _check_id) {
		this._check_id = _check_id;
	}

	public String get_user_name() {
		return _user_name;
	}

	public void set_user_name(String _user_name) {
		this._user_name = _user_name;
	}


}